import 'package:flutter/material.dart';

class TrapezoidPath extends CustomClipper<Path> {
  final bool reverse;

  TrapezoidPath(this.reverse);

  @override
  Path getClip(Size size) {
    var x = size.width;
    var y = size.height;
    var path = Path();
    path.moveTo(point(x, 0), y);

    path.lineTo(point(x, y*2/7), 0);
    path.lineTo(point(x, x), 0);
    path.lineTo(point(x, x), y);
    path.close();
    return path;
  }

  double point(double x,double point) => reverse?x-point:point;

  @override
  bool shouldReclip(covariant CustomClipper<Path> oldClipper) => true;
}